#pragma once

#include "FileTransfer.h"

using namespace FT;

class CFileIOTask;
class CFileIOManager;

class CFileTransfer : public IFileTransfer
{
public:
	CFileTransfer();
	~CFileTransfer();

	bool Init() override;
	void Exit() override;
	bool ReadFile(LPCWSTR lpFileName, IFileReaderPtr pCallback, INT64 nOffset, INT64 nLength) override;

private:
	void AddAndRunTask(const std::shared_ptr<CFileIOTask>& pTask);

	std::atomic_uint m_nLastTaskId;
	SRWLOCK          m_SRWLock = SRWLOCK_INIT;
	std::unique_ptr<CFileIOManager> m_pFileIOManager;
};
